<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
 <title>数量增减</title>
</head>
<body>
<h2><b>数量增减</b></h2>
<button onclick="jian()">-</button>
<input onkeyup="check()" id="num"style="width:40px;"value="1"/>
<button onclick="add()" >+</button>
</body>
<script>
function check(){
   console.log(1);
  if(parseInt(num.value)>10){
    num.value = 10;
  }
}
function jian(){
       
if(num.value>1)
  {
    num.value=parseInt(num.value)-1;
  }else{num.value=parseInt(num.value);}

}
function add(){       
if(num.value<10)
  {
    num.value=parseInt(num.value)+1;
  }else{num.value=num.value;}
}
</script>

</html>